package com.winning.pmph.entity;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Table;

/**
 * @author 吴笛
 * @date 2021/5/25
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Table(name = "term_standard_lib_history_item")
public class TermStandardLibHistoryItem extends BaseEntity {

    @TableId
    private String id;

    /** 术语ID */
    
    private String tid;

    /** 版本ID */
    private String vid;

    private Integer version;

    private String termBookMetadataId;

    private String conflictConceptId;

    private String xmlClassify;

    private String classify;

    private String name;

    private JSONArray synonym;

    private String englishName;

    private String englishAbbr;

    private String englishAbbrSynonym;

    private String englishNameSynonym;

    private String frenchName;

    private String frenchNameSynonym;

    private String russianName;

    private String russianNameSynonym;

    private String germanName;

    private String germanNameSynonym;

    private String japaneseName;

    private String japaneseNameSynonym;

    private String explanation;

    private int deleted;

    public TermStandardLibHistoryItem() {}

    public TermStandardLibHistoryItem(TermStandard term) {
        this.version = term.getVersion();
        this.tid = term.getId();
        this.name = term.getName();
        this.synonym = term.getSynonym();
        this.englishName = term.getEnglishName();
        this.englishNameSynonym = term.getEnglishNameSynonym();
        this.englishAbbr = term.getEnglishAbbr();
        this.englishAbbrSynonym = term.getEnglishAbbrSynonym();
        this.frenchName = term.getFrenchName();
        this.frenchNameSynonym = term.getFrenchNameSynonym();
        this.russianName = term.getRussianName();
        this.russianNameSynonym = term.getRussianNameSynonym();
        this.germanName = term.getGermanName();
        this.germanNameSynonym = term.getGermanNameSynonym();
        this.japaneseName = term.getJapaneseName();
        this.japaneseNameSynonym = term.getJapaneseNameSynonym();
        this.explanation = JSON.toJSONString(term.getExplanation());
        this.deleted = term.getDeleted();
        this.setCreatedBy(term.getCreatedBy());
        this.setCreatedTime(term.getCreatedTime());
        this.setUpdatedBy(term.getUpdatedBy());
        this.setUpdatedTime(term.getUpdatedTime());
    }
}
